﻿using System.Globalization;
using System.Reflection;

namespace PrivateAccessor.Tests
{
    public class TestClass
    {
        #region Field
        private string _privateField = "privateField";
        protected string _protectedField = "protectedField";
        internal string _internalField = "internalField";
        public string _publicField = "publicField";

        public string PrivateFieldValue {get { return _privateField; }}
        public string ProtectedFieldValue { get { return _protectedField; } }
        public string InternalFieldValue { get { return _internalField; } }
        public string PublicFieldValue { get { return _publicField; } }


        private static string _privateStaticField = "privateStaticField";
        protected static string _protectedStaticField = "protectedStaticField";
        internal static string _internalStaticField = "internalStaticField";
        public static string _publicStaticField = "publicStaticField";

        public static string PrivateStaticFieldValue { get { return _privateStaticField; } }
        public static string ProtectedStaticFieldValue { get { return _protectedStaticField; } }
        public static string InternalStaticFieldValue { get { return _internalStaticField; } }
        public static string PublicStaticFieldValue { get { return _publicStaticField; } }
        #endregion

        #region Func
        private string PrivateFunc0()
        {
            return MethodBase.GetCurrentMethod().Name;
        }
        private string PrivateFunc1(ParameterClass p1)
        {
            return string.Format("{0};{1}", MethodBase.GetCurrentMethod().Name, p1.Property1);
        }
        private string PrivateFunc2(int p1, string p2)
        {
            return string.Format("{0};{1};{2}", MethodBase.GetCurrentMethod().Name, p1, p2);
        }
        private string PrivateFunc3(int p1, string p2, decimal p3)
        {
            return string.Format("{0};{1};{2};{3}", MethodBase.GetCurrentMethod().Name, p1, p2, p3);
        }
        private string PrivateFunc4(int p1, string p2, decimal p3, bool p4)
        {
            return string.Format("{0};{1};{2};{3};{4}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4);
        }
        private string PrivateFunc5(int p1, string p2, decimal p3, bool p4, long p5)
        {
            return string.Format("{0};{1};{2};{3};{4};{5}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5);
        }
        private string PrivateFunc6(int p1, string p2, decimal p3, bool p4, long p5, ParameterClass p6)
        {
            return string.Format("{0};{1};{2};{3};{4};{5};{6}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5, p6.Property1);
        }
        private string PrivateFunc7(int p1, string p2, decimal p3, bool p4, long p5, ParameterClass p6, byte p7)
        {
            return string.Format("{0};{1};{2};{3};{4};{5};{6};{7}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5, p6.Property1, p7);
        }
        private string PrivateFunc8(int p1, string p2, decimal p3, bool p4, long p5, ParameterClass p6, byte p7, TestEnum p8)
        {
            return string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5, p6.Property1, p7, p8);
        }
        #endregion

        #region Action
        public string ActionResult { get; set; }
        public static string StaticActionResult { get; set; }

        private void PrivateAction0()
        {
            ActionResult = MethodBase.GetCurrentMethod().Name;
        }
        protected void ProtectedAction0()
        {
            ActionResult = MethodBase.GetCurrentMethod().Name;
        }
        internal void InternalAction0()
        {
            ActionResult = MethodBase.GetCurrentMethod().Name;
        }
        public void PublicAction0()
        {
            ActionResult = MethodBase.GetCurrentMethod().Name;
        }
        private static void PrivateStaticAction0()
        {
            StaticActionResult = MethodBase.GetCurrentMethod().Name;
        }
        protected static void ProtectedStaticAction0()
        {
            StaticActionResult = MethodBase.GetCurrentMethod().Name;
        }
        internal static void InternalStaticAction0()
        {
            StaticActionResult = MethodBase.GetCurrentMethod().Name;
        }
        public static void PublicStaticAction0()
        {
            StaticActionResult = MethodBase.GetCurrentMethod().Name;
        }
        protected virtual void ProtectedVirtualAction0()
        {
            ActionResult = MethodBase.GetCurrentMethod().Name;
        }
        public virtual void PublicVirtualAction0()
        {
            ActionResult = MethodBase.GetCurrentMethod().Name;
        }

        private void PrivateAction1(int p1)
        {
            ActionResult = string.Format("{0};{1}", MethodBase.GetCurrentMethod().Name, p1);
        }
        private void PrivateAction2(int p1, string p2)
        {
            ActionResult = string.Format("{0};{1};{2}", MethodBase.GetCurrentMethod().Name, p1, p2);
        }
        private void PrivateAction3(int p1, string p2, decimal p3)
        {
            ActionResult = string.Format("{0};{1};{2};{3}", MethodBase.GetCurrentMethod().Name, p1, p2, p3);
        }
        private void PrivateAction4(int p1, string p2, decimal p3, bool p4)
        {
            ActionResult = string.Format("{0};{1};{2};{3};{4}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4);
        }
        private void PrivateAction5(int p1, string p2, decimal p3, bool p4, long p5)
        {
            ActionResult = string.Format("{0};{1};{2};{3};{4};{5}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5);
        }
        private void PrivateAction6(int p1, string p2, decimal p3, bool p4, long p5, ParameterClass p6)
        {
            ActionResult = string.Format("{0};{1};{2};{3};{4};{5};{6}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5, p6.Property1);
        }
        private void PrivateAction7(int p1, string p2, decimal p3, bool p4, long p5, ParameterClass p6, byte p7)
        {
            ActionResult = string.Format("{0};{1};{2};{3};{4};{5};{6};{7}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5, p6.Property1, p7);
        }
        private void PrivateAction8(int p1, string p2, decimal p3, bool p4, long p5, ParameterClass p6, byte p7, TestEnum p8)
        {
            ActionResult = string.Format("{0};{1};{2};{3};{4};{5};{6};{7};{8}", MethodBase.GetCurrentMethod().Name, p1, p2, p3, p4, p5, p6.Property1, p7, p8);
        }

        private void PrivateActionOutParameter(int p1, ref int p2, out string p3)
        {
            p3 = (p1 + p2).ToString(CultureInfo.InvariantCulture);
        }


        #endregion

        #region Property
        private string _property1 = "Property1";
        private string PrivateProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }
        protected string ProtectedProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }
        internal string InternalProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }
        public string PublicProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }

        private static string _staticProperty = "StaticProperty";
        private static string PrivateStaticProperty
        {
            get { return _staticProperty; }
            set { _staticProperty = value; }
        }
        protected static string ProtectedStaticProperty
        {
            get { return _staticProperty; }
            set { _staticProperty = value; }
        }
        internal static string InternalStaticProperty
        {
            get { return _staticProperty; }
            set { _staticProperty = value; }
        }
        public static string PublicStaticProperty
        {
            get { return _staticProperty; }
            set { _staticProperty = value; }
        }

        protected virtual string ProtectedVirtualProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }
        internal virtual string InternalVirtualProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }
        public virtual string PublicVirtualProperty
        {
            get { return _property1; }
            set { _property1 = value; }
        }
        #endregion
    }

    public enum  TestEnum
    {
        M1 = 0,
        M2 = 1
    }
}
